package app

import (
	"net/http"
)

// Run 运行静态服务器
func Run(dir, port string, hook func(dir, port string)) {
	http.Handle("/", http.FileServer(http.Dir(dir)))
	if hook != nil {
		hook(FormatPath(dir), port)
	}
	http.ListenAndServe(":"+port, nil)
}
